package com.echovin.esb.gateway.mapper;

import com.echovin.esb.gateway.model.GatewayServerWebservice;
import org.apache.ibatis.annotations.*;

@Mapper
public interface GatewayServiceWebserviceMapper {
    @SelectKey(keyProperty = "record.id", resultType = String.class, before = true,
            statement = "select replace(uuid(), '-', '')")
    @Options(keyProperty = "record.id", useGeneratedKeys = true)
    @Insert("insert into GATEWAY_SERVICE_WEBSERVICE(ID,SERVICE_ID,WSDL,CREATER,CREATE_TIME) " +
            "values(#{record.id},#{record.serviceId},#{record.wsdl},#{record.creater},#{record.createTime})")
    int insert(@Param("record") GatewayServerWebservice record);

    @Update("update GATEWAY_SERVICE_WEBSERVICE set IS_DELETE = 1, UPDATER = #{record.updater}, UPDATE_TIME = #{record.updateTime} where ID = #{record.id}")
    int delete(GatewayServerWebservice record);

    @Update("update GATEWAY_SERVICE_WEBSERVICE set WSDL = #{record.wsdl}, UPDATER = #{record.updater}, UPDATE_TIME = #{record.updateTime} where ID = #{record.id}")
    int update(GatewayServerWebservice record);

}
